<?php


class composer {
	function form($object) {
		if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
		exponent_forms_initialize();
		
		$form = new form();
		if (!isset($object->id)) {
			$object->name = '';
			$object->body = '';
			$object->file_id = 0;
		} else {
			$form->meta('id',$object->id);
		}
		
		$form->register('name','Name',new textcontrol($object->name,50,false,200));
		$form->register('body','Info',new htmleditorcontrol($object->body));
		$form->register('submit','',new buttongroupcontrol('Save','','Cancel'));
		return $form;
	}
	
	function update($values,$object) {
		$object->name = $values['name'];
		$object->body = $values['body'];
		$object->file_id=intval($values['file_id']);
		return $object;
	}
}

?>